package com.campus;

/**
 * @desc:
 * @author: Shoko
 * @date: 2025/3/4
 */
// Rectangle 类，实现 Shape 接口
public class Rectangle implements Shape {
    private double length;
    private double width;

    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }

    @Override
    public double getArea() {
        return length * width; // 面积 = 长 * 宽
    }

    @Override
    public double getPerimeter() {
        return 2 * (length + width); // 周长 = 2 * (长 + 宽)
    }
}

